const Koa = require('koa');
const app = new Koa();
const views = require('koa-views');
const { resolve } = require('path');

app.use(views(resolve(__dirname, './views'), {
    extension: 'ejs'
}));

app.use(async (ctx, next) => {
    await ctx.render('index', {
        username: "sanfeng",
        age: 18
    })
})

app.listen(3000, () => {
    console.log('server is started.');
})
